let testUI: TestUI;

class TestUI{

	openBT:Laya.Button;
	closeBT:Laya.Button;
	testPage:RoleDlg;
	layer:Sprite;
	panelLayer:Sprite;
	backLayer:Sprite;
	public enemys: Array<Enemy> = [];//怪物集合
	
	constructor() {
		
		this.layer = new Sprite();
		this.panelLayer = new Sprite();
		this.openBT = new Laya.Button("comp/button.png","展开");
		this.closeBT = new Laya.Button("comp/button.png","关闭");
		this.closeBT.x = 140;
		this.closeBT.y = Laya.stage.height * 0.9;
		this.openBT.y = Laya.stage.height * 0.9;
		Laya.stage.addChild(this.panelLayer);
		
		
		this.testPage = new RoleDlg(this.panelLayer);

	
		// this.backLayer = new ui.map.GameMapUI();
		// this.layer.addChild(this.backLayer);

		
		
		game = new Game();
        game.init();
        game.mapView = new MapView();
        Laya.stage.addChild(game.mapView);
		game.startGame()
		Laya.stage.addChild(this.layer);
		// this.layer.addChild(this.openBT);
		// this.layer.addChild(this.closeBT);
		this.openBT.on(Laya.Event.CLICK,this,this.clickHandler);
		this.closeBT.on(Laya.Event.CLICK,this,this.clickCloseHandler);

	}


		

	clickHandler():void{

		console.log("clickHandler");
		this.testPage.animatingShow();
		game.startGame()
	}

	clickCloseHandler():void{

		console.log("clickCloseHandler");
		this.testPage.animatingClose();
	}
}